package week2.day13;

/**
 * @Author fengzihao
 * @Date 2024-04-27 14:00
 */
public class TestLambda {
    public static void main(String[] args) {
        INoReturnNoParam iNoReturnNoParam = ()-> System.out.println("INoReturnNoParam");
        INoReturnOneParam iNoReturnOneParam = a-> System.out.println("INoReturnOneParam and Param is " + a);
        INoReturnTwoParam iNoReturnTwoParam = (a,b)-> System.out.println("iNoReturnTwoParam has two param is " + a + " and " + b);
        iNoReturnNoParam.test();
        iNoReturnOneParam.test(100);
        iNoReturnTwoParam.test(12,13);

        IHasReturnNoParam iHasReturnNoParam = ()-> 10;
        IHasReturnOneParam iHasReturnOneParam = a -> a;
        IHasReturnTwoParam iHasReturnTwoParam = (a,b)-> a+b;
        System.out.println("iHasReturnNoParam.test() = " + iHasReturnNoParam.test());
        System.out.println("iHasReturnOneParam.method(20) = " + iHasReturnOneParam.method(20));
        System.out.println("iHasReturnTwoParam.test(20,90) = " + iHasReturnTwoParam.test(20, 90));

    }

}
//无返回值无参数的功能接口
@FunctionalInterface
interface INoReturnNoParam {
    void test();
}

//无返回值有一个参数的功能接口
@FunctionalInterface
interface INoReturnOneParam {
    void test(int a);
}

//无返回值两个参数的功能接口
@FunctionalInterface
interface INoReturnTwoParam {
    void test(int a, int b);
}

//有返回值无参数的功能接口
@FunctionalInterface
interface IHasReturnNoParam {
    int test();
}

//有返回值一个参数的功能接口
@FunctionalInterface
interface IHasReturnOneParam {
    int method(int a);
}

//有返回值两个参数的功能接口
@FunctionalInterface
interface IHasReturnTwoParam {
    int test(int a, int b);
}